/*-----------------------------------------
file name  : rdy_trans.sv
created    : 2025/10/04 09:45:02
modified   : 2025-10-05 12:23:44
description: 
notes      : 
author     : yyrwkk
-----------------------------------------*/
`ifndef RDY_TRANS__SV
`define RDY_TRANS__SV
class rdy_trans extends uvm_sequence_item;
    rand unsigned int  duration_time;
    rand unsigned int  interval_time;
    rdy_configuration  rdy_cfg      ;
   
    `uvm_object_utils_begin(rdy_trans) 
        `uvm_field_int(duration_time)
        `uvm_field_int(interval_time)
    `uvm_object_utils_end

    constraint cons_duration_time{
        (rdy_cfg.rand_mode == rand_mode_e::RAND_LONG ) -> { duration_time inside { [0:20   ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_SHORT) -> { duration_time inside { [200:500] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_FREQ ) -> { duration_time inside { [0:20   ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_ALL_1) -> { duration_time inside { [200:500] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_ALL_0) -> { duration_time inside { [0:0    ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_RAND ) -> { duration_time inside { [200:500] } } 
    } 

    constraint cons_interval_time{
        (rdy_cfg.rand_mode == rand_mode_e::RAND_LONG ) -> { duration_time inside { [200:500] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_SHORT) -> { duration_time inside { [0:20   ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_FREQ ) -> { duration_time inside { [0:20   ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_ALL_1) -> { duration_time inside { [0:0    ] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_ALL_0) -> { duration_time inside { [200:500] } } 
        (rdy_cfg.rand_mode == rand_mode_e::RAND_RAND ) -> { duration_time inside { [200:500] } } 
    }

    extern function new( string name = "rdy_trans" );
    extern function void set_cfg(rdy_configuration rdy_cfg); 
    extern task pre_randomize();
endclass

function rdy_trans::new(string name = "rdy_trans");
    super.new(name);
endfunction 

function void rdy_trans::set_cfg(rdy_configuration rdy_cfg);
    this.rdy_cfg = rdy_cfg;
    rdy_cfg.print();
endfunction

task rdy_trans::pre_randomize();
    if( rdy_cfg == null )
        `uvm_fatal("rdy_trans", "rdy_trans is null, can't randomize rdy_trans!")
endtask 

`endif
